
#include "mainwidget.h"


mainWidget::mainWidget(QWidget *parent)
    : QWidget(parent)
{
    layout = new QGridLayout(this);
    lblGameWindow = new GameWindowLabel(this);
 //   spinlvl = new QSpinBox(this);
 //   spinlvl ->setRange(1,50);
//    spinlvl->setAlignment(Qt::AlignHCenter);
//    spinlvl->setPrefix("难度等级：");
//    spinlvl->setFixedHeight(40);
//   spinlvl->setFocusPolicy(Qt::NoFocus);

    btnStart = new QPushButton("开 始",this);
    btnStart->setFixedHeight(40);



    layout->addWidget(lblGameWindow, 0, 0, 1, 2);
    layout->addWidget(btnStart,1,0);
  //  layout->addWidget(spinlvl,1,0);
  //   int lvl1 = spinlvl->value();


    layout->setContentsMargins(0,0,0,0);
    layout->setSpacing(0);

    setFixedSize(800,800);
    setWindowTitle("保国‘s 挑战");

    connect(btnStart,&QPushButton::clicked,this,[=](){
        //qDebug()<<"btnStart clicked";
        lblGameWindow->generateWords(10);//产生单词的数量
    });
}
void mainWidget::keyPressEvent(QKeyEvent *ev){
    //qDebug() << ev->text();
    lblGameWindow->getKey(ev->text());
}


mainWidget::~mainWidget()
{
}


